home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / musictex / older-versions / musictex.500 / EXTRAS.TEX < prev    next >
Text File  |  1992-06-02  |  13KB  |  303 lines

  1. % A logo
  2. \def\musictex{\leavevmode\hbox{Music\TeX}}
  3.  
  4. % Here I define an extra font for the dynamics, at 10pt.
  5. \font\ppffx=\fonthdg mbxti10
  6.  
  7. % I like the size of the bold italic to depend on the size of the music, so
  8. % I define this. It would be better for this to be defined in
  9. % \computespecifics however.
  10. \def\ppffs{\ifnum\musicsize=20\ppff\else\ppffx\fi}
  11.  
  12. % \dyn {pitch}{text} inserts a dynamic
  13. \def\dyn#1#2{\zcharnote{#1}{{\ppffs #2}}}
  14.  
  15. % \nobarnumbers prevents bar numbering
  16. \def\nobarnumbers{\def\wbarno{\relax}}
  17.  
  18. % \barnumbers restores bar numbering
  19. \def\barnumbers{\def\wbarno{\w@barno}}
  20.  
  21. % \tab is defined as a tab character, so that I can still use tabs.
  22. \catcode`\@=4
  23. \let\tab=@
  24. \catcode`\@=11
  25.  
  26. % The next few sections define some extra macros to produce notes.
  27. % They are sometimes useful, but you may not want to use them.
  28.  
  29. \def\nqu#1{\rlap{\qu{#1}}}
  30. \def\nql#1{\rlap{\ql{#1}}}
  31. \def\nhu#1{\rlap{\hu{#1}}}
  32. \def\nhl#1{\rlap{\hl{#1}}}
  33. \def\nw#1{\rlap{\wh{#1}}}
  34. \def\nwh#1{\rlap{\wh{#1}}}
  35. \def\nqup#1{\rlap{\qup{#1}}}
  36. \def\nqlp#1{\rlap{\qlp{#1}}}
  37. \def\nhup#1{\rlap{\hup{#1}}}
  38. \def\nhlp#1{\rlap{\hlp{#1}}}
  39. \def\ncl#1{\rlap{\cl{#1}}}
  40. \def\ncu#1{\rlap{\cu{#1}}}
  41.  
  42. % shifted dotted whole notes
  43. \def\rwp#1{\kern \wd@skip\zwp{#1}\kern -\wd@skip}
  44. \def\lwp#1{\kern -\wd@skip\zwp{#1}\kern \wd@skip}
  45.  
  46. % Half-shifted notes. I sometimes use these for close intervals: for instance
  47. % \zlqu g\zrql f
  48.  
  49. \def\zrwh{\zrw}
  50. \def\zlwh{\zlw}
  51. \def\zrw#1{\kern .52\wd@skip\nw{#1}\kern -.52\wd@skip}
  52. \def\zlw#1{\kern -.52\wd@skip\nw{#1}\kern .52\wd@skip}
  53. \def\zrhu#1{\kern .45\hn@width\nhu{#1}\kern -.45\hn@width}
  54. \def\zlhu#1{\kern -.45\hn@width\nhu{#1}\kern .45\hn@width}
  55. \def\zrhl#1{\kern .45\hn@width\nhl{#1}\kern -.45\hn@width}
  56. \def\zlhl#1{\kern -.45\hn@width\nhl{#1}\kern .45\hn@width}
  57. \def\zrhup#1{\kern .45\hn@width\nhup{#1}\kern -.45\hn@width}
  58. \def\zlhup#1{\kern -.45\hn@width\nhup{#1}\kern .45\hn@width}
  59. \def\zrhlp#1{\kern .45\hn@width\nhlp{#1}\kern -.45\hn@width}
  60. \def\zlhlp#1{\kern -.45\hn@width\nhlp{#1}\kern .45\hn@width}
  61. \def\zrqu#1{\kern .45\qd@skip\nqu{#1}\kern -.45\qd@skip}
  62. \def\zlqu#1{\kern -.45\qd@skip\nqu{#1}\kern .45\qd@skip}
  63. \def\zrql#1{\kern .45\qd@skip\nql{#1}\kern -.45\qd@skip}
  64. \def\zlql#1{\kern -.45\qd@skip\nql{#1}\kern .45\qd@skip}
  65. \def\zrqup#1{\kern .45\qd@skip\nqup{#1}\kern -.45\qd@skip}
  66. \def\zlqup#1{\kern -.45\qd@skip\nqup{#1}\kern .45\qd@skip}
  67. \def\zrqlp#1{\kern .45\qd@skip\nqlp{#1}\kern -.45\qd@skip}
  68. \def\zlqlp#1{\kern -.45\qd@skip\nqlp{#1}\kern .45\qd@skip}
  69. \def\zrcu#1{\kern .45\qd@skip\zcu{#1}\kern -.45\qd@skip}
  70. \def\zlcu#1{\kern -.45\qd@skip\zcu{#1}\kern .45\qd@skip}
  71. \def\zrcl#1{\kern .45\qd@skip\zcl{#1}\kern -.45\qd@skip}
  72. \def\zlcl#1{\kern -.45\qd@skip\zcl{#1}\kern .45\qd@skip}
  73. %
  74. % half left shifted accidentals - for putting before half shifted notes
  75. %
  76. \def\hlfl#1{\getn@i{#1}\global\n@raise=\fl@raise
  77.   \pl@llap{\f@lat\kern 0.45\qd@skip}%
  78. }%
  79. \def\hldfl#1{\getn@i{#1}\global\n@raise=\fl@raise
  80.   \pl@llap{\df@lat\hskip 0.45\qd@skip}%
  81. }%
  82. \def\hlsh#1{\getn@i{#1}\global\n@raise=\sh@raise
  83.   \pl@llap{\s@harp\hskip 0.45\qd@skip}%
  84. }%
  85. \def\hldsh#1{\getn@i{#1}\global\n@raise=\z@
  86.   \pl@llap{\ds@harp\hskip 0.45\qd@skip}}%
  87. \def\hlna#1{\getn@i{#1}\global\n@raise=\na@raise
  88.   \pl@llap{\n@at\hskip 0.45\qd@skip}}%
  89. %
  90. % cautionary accidentals
  91. % A cautionary accidental is a small one surrounded by parentheses, used for
  92. % reminders.  Type the usual accidental name preceded by "c"
  93. %
  94. \def\caution#1#2{\kern -.4\qd@skip\zcharnote{#2}{\raise
  95. -.45\Interligne\hbox{\ttyeight\kern -1.4\qd@skip
  96.  \rlap{(}\kern1.2\qd@skip)}}#1#2\kern .4\qd@skip}
  97.  
  98. \def\cfl{\caution{\smallfl}}
  99. \def\csh{\caution{\smallsh}}
  100. \def\cna{\caution{\smallna}}
  101. \def\cdfl{\caution{\smalldfl}}
  102. \def\cdsh{\caution{\smalldsh}}
  103. \def\cFl{\caution{\smallFl}}
  104. \def\cSh{\caution{\smallSh}}
  105. \def\cNa{\caution{\smallNa}}
  106. \def\cdFl{\caution{\smalldFl}}
  107. \def\cdSh{\caution{\smalldSh}}
  108.  
  109. % The following macros can be used to surround a note by parentheses. They
  110. % are also used as ornaments by J.P. Rameau.
  111. % \lpar p  produces a left parenthesis, or "port de voix" at pitch p
  112. % \rpar p  produces a right parenthesis, or "pinc\'e"
  113.  
  114. \def\lpar#1{\zcharnote #1{\raise -2.5pt\hbox{\tentt\kern -.9\Interligne (}}}
  115. \def\rpar#1{\zcharnote #1{\raise -2.5pt\hbox{\tentt\kern 1.1\Interligne )}}}
  116.  
  117. \newdimen\tmp@dimen
  118. \def\bracketshrink{0.17\Interligne}
  119.  
  120. % \bracket pn draws a square bracket ( [ ) to bracket an interval of an n-th
  121. % whose lowest note is p.
  122.  
  123. \def\bracket#1#2{\tmp@dimen #2\Interligne\advance\tmp@dimen by\Interligne
  124.    \divide\tmp@dimen by2\relax
  125.    \advance\tmp@dimen by-\bracketshrink\advance\tmp@dimen by-\bracketshrink
  126.    \advance\tmp@dimen by-\lthick
  127.    \zcharnote#1{\kern-.75\Interligne\raise-.5\Interligne
  128.    \hbox{\raise\bracketshrink\hbox{\rlap{\vrule height\tmp@dimen}\relax
  129.    \rlap{\vbox{\hrule width .5\Interligne}}\relax
  130.    \raise\tmp@dimen\vbox{\hrule width .5\Interligne}}}}}
  131.  
  132. \newdimen\tmp@dimenc
  133. \newdimen\z@iii\newdimen\z@iv\newdimen\z@v
  134.  
  135. % \oblique {l}{s}{h} draws an oblique line of length l, slope s percent, and
  136. % height h. This will cause an unrecorded space so it should be used within
  137. % \rlap. Note that this macro is a hack and probably gobbles up resources!
  138. % This macro is used by some of the others which follow.
  139.  
  140. \def\oblique#1#2#3{\relax % length slope height
  141. \ifnum #2=0\relax\raise #3\vbox{\hrule width #1 height\lthick depth\z@}\relax
  142. \else\q@antum=25\lthick\divide\q@antum by #2\relax
  143. \ifdim\q@antum<0pt\relax\multiply\q@antum by -1\fi
  144. \global\z@iv=0pt\relax
  145. \loop\ifdim\z@iv<#1\relax
  146.  {\z@v=#1\relax\advance\z@v by -\z@iv\relax\advance\z@v by -\q@antum\relax
  147.  \tmp@dimenc\z@iv\multiply\tmp@dimenc by#2\relax
  148.  \z@iii=#3\relax\advance\z@iii by .01\tmp@dimenc\relax\advance\z@iii by
  149.  -0.5\internote
  150.  \ifnum #2<0\relax\advance\z@iii by \lthick\relax\fi
  151.  \tmp@dimenc\z@v\multiply\tmp@dimenc by#2\relax
  152.  \ifdim\z@v<0pt\relax\advance\z@iii by .01\tmp@dimenc\relax\hskip\z@v\fi
  153.  \advance\z@iii by 0.6\internote\relax
  154.  \raise\z@iii\hbox to \q@antum{\vrule width\q@antum height .5\lthick depth
  155.  .5\lthick}\relax
  156.  \global\advance\z@iv by \q@antum\relax
  157. }\repeat
  158. \fi
  159. }
  160.  
  161. \newdimen\tmp@dimenb\newcount\tmp@ct
  162. \def\crescwidth{1.8\Interligne}
  163.  
  164. % These macros produce variable size crescendo and diminuendo marks.
  165. % \varcresc{p}{l} produces a crescendo at pitch p, and of length l, causing
  166. % no space.
  167. \def\varcresc#1#2{\relax% height (note), length (dimen)
  168.    \tmp@dimenb \crescwidth\tmp@dimen #2\multiply
  169.    \tmp@dimenb by50\divide\tmp@dimenb by\tmp@dimen \tmp@ct\tmp@dimenb
  170.    \ifnum 0=\tmp@ct\relax
  171.    \tmp@ct 1\fi
  172.    \getn@i{#1}\tmp@dimen\n@i\internote
  173.    \rlap{\oblique{#2}{\tmp@ct}{\tmp@dimen}}\relax
  174.    \advance\tmp@dimen by-\lthick
  175.    \rlap{\oblique{#2}{-\tmp@ct}{\tmp@dimen}}}
  176.  
  177. % \vardim{p}{l}  draws a diminuendo at pitch p, and of length l, causing
  178. % no space.
  179. \def\vardim#1#2{\tmp@dimenb 1.6\Interligne\tmp@dimen #2\multiply
  180.    \tmp@dimenb by50\divide\tmp@dimenb by\tmp@dimen \tmp@ct\tmp@dimenb
  181.    \ifnum 0=\tmp@ct\relax
  182.    \tmp@ct 1\fi
  183.    \getn@i{#1}\tmp@dimen\n@i\internote
  184.    \tmp@dimenb\crescwidth\divide\tmp@dimenb by2\relax
  185.    \advance\tmp@dimen by\tmp@dimenb
  186.    \rlap{\oblique{#2}{-\tmp@ct}{\tmp@dimen}}\relax
  187.    \advance\tmp@dimen by \lthick
  188.    \tmp@dimenb #2\multiply\tmp@dimenb by\tmp@ct\advance\tmp@dimen
  189.  by-.02\tmp@dimenb
  190.    \rlap{\oblique{#2}{\tmp@ct}{\tmp@dimen}}}
  191.  
  192. % \overbracket{p}{l}{s}   draws a bracket over the music starting at the
  193. % current position at pitch p, width l and slope s percent, causing no space.
  194. \def\overbracket#1#2#3{\relax % height (note), length (dimen) slope (%)
  195.    \tmp@dimenb #2\multiply\tmp@dimenb by#3\divide\tmp@dimenb by100\relax
  196.    \getn@i{#1}\advance\tmp@dimenb by\n@i\internote\rlap{\relax
  197.    \raise\n@i\internote\rlap{\vrule width\lthick height \lthick
  198.    depth .8\Interligne}\oblique{#2}{#3}{\n@i\internote}\relax
  199.    \advance\tmp@dimenb by.5\lthick\relax
  200.    \raise\tmp@dimenb\hbox{\vrule width\lthick height \lthick
  201.  depth.8\Interligne}}}
  202.  
  203. % \ovbkt{p}{n}{s} is the same as \overbracket, except that it draws the
  204. % bracket to cover n notes (note however that glue inserted by \temps
  205. % commands will expand the space between the notes but will not affect the
  206. % bracket).
  207. % I use this macro to indicate triplets, for instance.
  208.  
  209. \def\ovbkt#1#2#3{\relax % height (note), length (number of notes) slope (%)
  210.    \tmp@dimen #2\noteskip\advance\tmp@dimen by\wd@skip\advance\tmp@dimen
  211.    by -\noteskip\advance\tmp@dimen by\lthick \overbracket{#1}{\tmp@dimen}{#3}}
  212.  
  213. % \underbracket and \unbkt are similar to the above, but produce
  214. % brackets under the music.
  215. \def\underbracket#1#2#3{\relax % height (note), length (dimen) slope (%)
  216.    \tmp@dimenb #2\multiply\tmp@dimenb by#3\divide\tmp@dimenb by100\relax
  217.    \getn@i{#1}\advance\tmp@dimenb by\n@i\internote\rlap{\relax
  218.    \raise\n@i\internote\rlap{\vrule width\lthick depth -\lthick
  219.    height \Interligne}\oblique{#2}{#3}{\n@i\internote}\relax
  220.    \advance\tmp@dimenb by.5\lthick\relax
  221.    \raise\tmp@dimenb\hbox{\vrule width\lthick depth -\lthick
  222.  height\Interligne}}}
  223. \def\unbkt#1#2#3{\relax % height (note), length (number of notes) slope (%)
  224.    \tmp@dimen #2\noteskip\advance\tmp@dimen by\wd@skip\advance\tmp@dimen
  225.    by -\noteskip\advance\tmp@dimen by\lthick
  226.    \kern-2\lthick\underbracket{#1}{\tmp@dimen}{#3}\kern2\lthick}
  227.  
  228. % Here are several macros to make use of the alternative note graphics found
  229. % in the font files. I copied the idea from the usual note macros in
  230. % MusicTeX.
  231.  
  232. % \gu produces grace notes (acciacaturas), stems up
  233. % \gl produces grace notes, stems down
  234. % \smqu,\smql,\smhu,\smhl,\smwh produce small versions of \qu,\ql,\hu,\hl,\wh
  235. % respectively.
  236.  
  237. \def\gu@raise{\lthick}\def\gl@raise{\lthick}\def\br@raise{\lthick}%
  238. \def\g@u{{\musicxx\char"45}}%
  239. \def\g@l{{\musicxx\char"46}}%
  240. \def\gu#1{\getn@i{#1}\def\n@fon{\gu}\global\n@raise=\gu@raise\def\n@sym{\g@u}\g@
  241. gr}%
  242. \def\gl#1{\getn@i{#1}\def\n@fon{\gl}\global\n@raise=\gl@raise\def\n@sym{\g@l}\g@
  243. gr}%
  244. \def\g@all#1{\ifnum\n@i<100\relax
  245.   \h@lines{#1}\global\stem@skip=\hd@skip
  246.   \def\s@tem{\relax}\pl@note\raise@note{\n@sym\hss}\ss@uite\fi}%
  247. \def\g@gr{\g@all{1.15\interligne}}%
  248. \def\sm@qu{{\musicxx\char"25\vrule height 2\Interligne depth\z@}}
  249. \def\sm@ql{{\vrule depth 2\Interligne height\z@\kern-.5pt\musicxx\char"25}}
  250. \def\sm@hu{{\musicxx\char"26\vrule height 2\Interligne depth\z@}}
  251. \def\sm@hl{{\vrule depth 2\Interligne height\z@\kern-.5pt\musicxx\char"26}}
  252. \def\sm@wh{{\musicxx\char"27}}
  253. \let\sm@raise\lthick
  254. \def\g@sm{\g@all{1.1\interligne}}%
  255. \def\g@smw{\g@all{1.3\interligne}}%
  256. \def\smqu#1{\getn@i{#1}\def\n@fon{\smqu}\global\n@raise=\sm@raise\def\n@sym{\sm@
  257. qu}\g@sm}%
  258. \def\smql#1{\getn@i{#1}\def\n@fon{\smql}\global\n@raise=\sm@raise\def\n@sym{\sm@
  259. ql}\g@sm}%
  260. \def\smhu#1{\getn@i{#1}\def\n@fon{\smhu}\global\n@raise=\sm@raise\def\n@sym{\sm@
  261. hu}\g@sm}%
  262. \def\smhl#1{\getn@i{#1}\def\n@fon{\smhl}\global\n@raise=\sm@raise\def\n@sym{\sm@
  263. hl}\g@sm}%
  264. \def\smwh#1{\getn@i{#1}\def\n@fon{\smwh}\global\n@raise=\sm@raise\def\n@sym{\sm@
  265. wh}\g@smw}%
  266. %
  267. % This skip aligns some ornaments which appear not to be centred precisely
  268. % on the notes
  269. \def\o@skp{\hskip-.5\hd@skip}
  270.  
  271. % \turn p      makes a turn             symbol at pitch p, causing no space
  272. % \backturn p  makes a backward turn    symbol at pitch p, causing no space
  273. % \ttrill p    makes a terminated trill ...
  274. % \coda p      makes a coda             ...
  275. % \segno p     makes the special "S"    ...
  276. \def\turn#1{\zcharnote{#1}{\o@skp\musicxx\char"44}}
  277. \def\backturn#1{\zcharnote{#1}{\o@skp\musicxx\char"43}}
  278. \def\ttrill#1{\zcharnote{#1}{\o@skp\musicxx\char"58\dimen@4.6pt%
  279.    \advance\dimen@-1.5\internote\tenrm\lower\dimen@\hbox{'}}}
  280. \def\coda#1{\zcharnote{#1}{\o@skp\musicxx\char"55}}
  281. \def\segno#1{\zcharnote{#1}{\o@skp\musicxx\char"56}}
  282.  
  283. % J.P. Rameau indicated "arpegements" by drawing oblique strokes through the
  284. % note stems.
  285. % \downarpeg p  is written just before the note at pitch p with its stem
  286. %               pointing up in order to indicate a descending arpeggio
  287. % \uparpeg p    is written just before the note at pitch p with its stem
  288. %               pointing down in order to indicate an ascending arpeggio
  289.  
  290. \font\linew=linew10 %would be nice to have slightly shorter lines...
  291. \def\downarpeg#1{\getn@i{#1}\advance\n@i by3\raise\n@i\internote
  292.  \rlap{\linew\char"61}}
  293. \def\uparpeg#1{\getn@i{#1}\advance\n@i by-3\raise\n@i\internote
  294.  \rlap{\linew\char"21}}
  295.  
  296. % \qqs is a demi-semiquaver rest
  297. \def\qqs{\charnote0{{\musicxx\char"41}}}
  298.  
  299. % These macros change context while forbidding line breaks
  300. \def\xchangecontext{{\def\updatecontext{\x@updatecon}\changecontext}}
  301. \def\xChangecontext{{\def\updatecontext{\x@updatecon}\Changecontext}}
  302.  
  303.